<template>
	<view>
		<uni-table  border stripe emptyText="暂无更多数据" style="margin-top: 10px;">
			<uni-tr class="table-th">
				<uni-th width="50" align="center">单号</uni-th>
				<uni-th width="90" align="center">日期</uni-th>
				<uni-th width="60" align="center">品名</uni-th>
				<uni-th width="30" align="center">数量</uni-th>
				<uni-th width="50" align="center">执行人</uni-th>
			</uni-tr>
			<uni-tr v-for="(item, index) in dataList" :key="index">
				<uni-td>{{ item.worksheetNumber }}</uni-td>
				<uni-td>{{ item.createTime }}</uni-td>
				<uni-td>{{ item.productName }}</uni-td>
				<uni-td>{{ item.count }}</uni-td>
				<uni-td>{{ item.createName }}</uni-td>
			</uni-tr>
		</uni-table>
	</view>
</template>

<script>
	export default {
		name:"scan-printer-wasteRecord",
		data() {
			return {
				dataList: [],
				params: {
					deviceId:''
				},
			};
		},
		methods:{
			getInitDataList(deviceId) {
				this.params.deviceId=deviceId;
				this.params.pageNum = 1;
				this.status = 'loadmore';
				this.dataList = [];
				this.getDataList();
			},
			async getDataList() {
				if (this.status != 'nomore') {
					this.status = 'loading';
					console.log("得到的损耗请求参数",this.params);
					const res = await API.listCompletionProduct({
						params: this.params
					});
					console.log("得到的损耗记",res);
					this.dataList = this.dataList.concat(res.rows);
					this.params.pageNum += 1;
					if (res.total <= this.params.pageNum * this.params.pageSize) {
						this.status = 'nomore';
					} else {
						this.status = 'loadmore';
					}
				}
			},
		}
	}
</script>

<style lang="less">
	
	.table-th {
		background-color: #038dfa25;
	}
	
	/deep/ .uni-table-th {
		padding: 6px 4px;
		font-size: 13px;
		color: #404040;
	}
	
	/deep/ .uni-table-td {
		padding: 4px 4px;
		text-align: center !important;
	}

	/deep/ .table--stripe .uni-table-tr:nth-child(2n+3) {
		background-color: #038dfa0c;
	}
</style>